﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YeaTrip.Web.Models.Account;
using YeaTrip.Web.Common;

namespace YeaTrip.Web.Controllers
{
    public class AccountController : YeaTrip.Framework.VC.YeaTripController
    {        
        public ActionResult Login()
        {
            return View();
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="loginIn"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult Login(LoginModel loginIn)
        {
            //if (EWinSession.GetSession(SessionEnum.LoginValidateCode) == null ||
            //    loginIn.ValidateCode == null ||
            //    loginIn.ValidateCode.ToLower() != (EWinSession.GetSession(SessionEnum.LoginValidateCode) as string).ToLower())
            //{
            //    ModelState.AddModelError("ValidateCode", "验证码不正确");
            //}
            //登录失败，重新登录
            if (!ModelState.IsValid)
            {
                loginIn.ErrMsg = Error.GetModelStateErrors(ModelState, '；').Trim('；');
            }
            return View();
        }

    }
}
